package com.example.firstapp.activity;

import android.app.Activity;
import android.os.Bundle;
import android.widget.ListView;

import com.example.firstapp.R;
import com.example.firstapp.adapter.ReviewAdapter;
import com.example.firstapp.entity.Restaurant;
import com.example.firstapp.entity.RestaurantReview;

public class ReviewActivity extends Activity {

	private ListView listview;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_review);

		// Review[] reviewdata = new Review[] {
		// new Review(
		// "Vassilis",
		// new Date(),
		// R.drawable.rate_5,
		// "I went there with my French friend and we loved it. We both agreed it was the best beer we ever had!"),
		// new Review("Groeri", new Date(), R.drawable.rate_4,
		// "Small, what we may call brown pub") };

		Restaurant restaurant = ((MobileApplication) getApplication())
				.getRestaurant();
		ReviewAdapter adapter = new ReviewAdapter(this,
				R.layout.review_row_layout, restaurant.getReviews().toArray(
						new RestaurantReview[restaurant.getReviews().size()]));
		listview = (ListView) findViewById(R.id.review_list);
		listview.setAdapter(adapter);
	}

}
